package cn.anquing.study.qlexpress.demo;

import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;

/**
 * macro 宏定义
 * @author wangquanqing
 * @since 2021/2/23 10:39
 */
public class Demo5 {

    public static void main(String[] args) throws Exception {
        ExpressRunner runner = new ExpressRunner();
        DefaultContext<String, Object> context = new DefaultContext<String, Object>();
        runner.addMacro("计算平均成绩", "(语文+数学+英语)/3.0");
        runner.addMacro("是否优秀", "计算平均成绩>90");
        context.put("语文", 88);
        context.put("数学", 99);
        context.put("英语", 95);
        Object result1 = runner.execute("计算平均成绩", context, null, false, false);
        Object result2 = runner.execute("是否优秀", context, null, false, false);
        System.out.println(result1 );
        System.out.println(result2 );
        //返回结果：
        //94.0
        //true


    }
}
